import { Actions } from 'react-native-router-flux';

// antd 按需加载
import { Toast } from '@ant-design/react-native';

import store from '../../../store/store.js'
import * as ActionTypes from '../../../constants/constants.js'
import { isUser, isWxUser, path, saveData, loadData, removeData } from '../../../util/utils.js'
import request from '../../../api/request.js'

export async function addOrder(options) {
    const { dispatch } = this.props
    const res = await request.BehalfController.addOrder(options)

    if (res.data.code == 200) {
        Toast.success('下单成功，客服会在一个工作日内处理您的订单。', 2, () => {
            Actions.orderList()
        }, false)
    } else {
        Toast.fail('提交失败', 1, null, false)
    }
}
